package gtkwire.gobject;

import gtkwire.GTKWireApp;

public abstract class GObject
{
	//------------------------------------------------ G_Object types
	public static final int GO_UNDEFINED = 0;
	public static final int GO_GtkTreeViewColumn = 1;
	public static final int GO_GtkListStore = 2;
	public static final int GO_CtkCellRenderer = 3;
	public static final int GO_GtkTreeSelection = 4;
	public static final int GO_GdkPixBuf = 5;
	public static final int GO_GtkCellRendererText = 6;
	public static final int GO_GtkCellRendererToggle = 7;
	public static final int GO_GtkCellRendererStockImage = 8;
	public static final int GO_GtkCellRendererProgress = 9;
	public static final int GO_GtkCellRendererPixbuf = 10;
	public static final int GO_GtkAdjustment = 11;

	public static final String MAGIC_NAME = "##G_OBJECT##%%##%%##";
	public static final String GOBJECT_WIDGET_TYPE = "GObject";

	/**
	* Runtime id. Don not try to use for persistance.
	*/
	protected int id;
	/**
	* Id for next created GObject;
	*/
	private static int nextId = 11;
	/**
	* GObject type.
	*/
	protected int type = GO_UNDEFINED;

	/**
	* Protected final
	*/
	
	public GObject( int type )
	{
		this.id = nextId;
		this.type = type;
		nextId++;//will overflow, never mind.
	}

	public int getId(){ return id; }

	protected void createGObjectInstance(  String[] data )
	{
		System.out.println("täällä ollan");
		app().createGObject( type, id, data );

	}

	public void setProperty( String property, GType type, String value )
	{
		app().setGObjectProperty( id, property, type.getCode(), value);
	}

	protected GTKWireApp app(){ return GTKWireApp.instance(); }
	
}//end class